package net.dgitc.xingyannian.service;

import net.dgitc.xingyannian.entity.Student;
import net.dgitc.xingyannian.mapper.StudentMapper;
import org.springframework.stereotype.Service;

/**
 * StudentServiceImpl
 *
 * @author XING&WANG
 * @version 2024/08/26 20:08
 **/
@Service
public class StudentServiceImpl implements StudentService {
    private final StudentMapper studentMapper;

    public StudentServiceImpl(StudentMapper studentMapper) {
        this.studentMapper = studentMapper;
    }
    @Override
    public Student getStudentInfo(String sName, String sPid) {
        return this.studentMapper.getStudentByNameAndPid(sName, sPid);
    }

    @Override
    public Iterable<Student> getAllStudents() {
        return this.studentMapper.getAllStudents();
    }

    @Override
    public void addStudent(Student student) {
        this.studentMapper.insertStudent(student);
    }
}
